﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Speech.Synthesis;
using System.Web;

/// <summary>
/// SpeechEngine 的摘要说明
/// </summary>
public class SpeechEngine
{
    private SpeechEngine()
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //
    }

    private readonly static SpeechEngine instance = new SpeechEngine();
    /// <summary>
    /// 实例访问单例.
    /// </summary>
    public static SpeechEngine Instance
    {
        get { return SpeechEngine.instance; }
    }



    /// <summary>
    /// 
    /// </summary>
    private System.Collections.Concurrent.ConcurrentDictionary<string, SpeechState> speechDictionary = new System.Collections.Concurrent.ConcurrentDictionary<string, SpeechState>();
    /// <summary>
    /// 声音缓存状态管理类
    /// </summary>
    public System.Collections.Concurrent.ConcurrentDictionary<string, SpeechState> SpeechDictionary
    {
        get { return speechDictionary; }
    }

    /// <summary>
    /// 声音状态
    /// </summary>
    public class SpeechState
    {
        public SpeechState() { CreateTime = DateTime.Now; }

        /// <summary>
        /// key
        /// </summary>
        public string Key { get; set; }
        /// <summary>
        /// 处理对像
        /// </summary>
        public SpeechSynthesizer Speech { get; set; }


        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; protected set; }
        /// <summary>
        /// 交互时间
        /// </summary>
        public DateTime InteractiveTime { get; set; }
    }

}